import 'package:flutter/material.dart';

class SecondPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _SecondPageState();
  }
}

class _SecondPageState extends State<SecondPage> {
  List msg;
  @override
  Widget build(BuildContext context) {
    if (ModalRoute.of(context).settings.arguments is List) {
      msg = ModalRoute.of(context).settings.arguments as List;
    }
    return Scaffold(
      appBar: AppBar(
        title: Text("second page"),
        centerTitle: true,
      ),
      body: Center(
        child: Column(
          children: [
            TextButton(

                /// 进行参数的返回，在pop中的第二个参数
                onPressed: () => Navigator.pop(context, 'bbbbb'),
                child: Text(
                    "back to first page with msg from first page: ${msg.toString()}"))
          ],
        ),
      ),
    );
  }
}
